<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        //遍历对象
        var obj = {
            name: 'starbug',
            age: 18,
            sex: '男',
            fn: function() {
                console.log('xxx');
            }
        }
        for (var k in obj) {
            console.log(k);
            console.log(obj[k]);
        }
    </script>
</head>

<body>

</body>

</html>